<template>
  <div>

    <el-tabs  v-model="activeName"  @tab-click="handleClick">
    <el-tab-pane v-for="i,index in plist" :key="index" :label="i.name" :name="i.id"></el-tab-pane>
    
    <el-table
    :data="phlist"
    style="width: 100%">
    <el-table-column
      fixed
      prop="id"
      label="序号"
      width="150">
    </el-table-column>
    <el-table-column
      prop="name"
      label="照片名"
      width="120">
    </el-table-column>
    <template :slot-scope="scope.row">
      <el-table-column
      prop="url"
      label="照片"
      width="120">
     
    </el-table-column>
      
    </template>
    
    <el-table-column
      fixed="right"
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button @click="acc(scope.row)" type="text" size="small">查看</el-button>
      </template>
    </el-table-column>
  </el-table>

  </el-tabs>

  <div>
    <el-input v-model="name" placeholder="添加相册名"></el-input> <el-button @click="photoadd">添加</el-button>
  </div>
  <div>
    <el-input v-model="name" placeholder="添加相册名"></el-input> <el-button @click="photoadd">添加</el-button>
  </div>
  </div>
</template>

<script>
export default {
  data() {
      return {
        activeName:"",
        plist:[],
        phlist:[],
        name:"",
        id:1
      };
    },
    mounted(){
      this.photget()
    },
    methods: {
      photoadd(){
        this.axios.post("user/photoadd",{"name":this.name}).then(res=>{
          this.photget()
        })
      },
      handleClick(){
        
        console.log(event.target.getAttribute('id')) 
        this.axios.get("user/phget?cid=1").then(res=>{
          this.phlist = res.data.pgetlist
        })
      },
      photget(){
        this.axios.get('user/photget').then(res=>{
          this.plist = res.data.pholist
        })
      },
      phget(){
        
      }
    }
}
</script>

<style>

</style>